package com.losca.gulimall.auth.decorative;

public abstract class Beverage {

    String description;

    public String getDescription() {
        return description;
    }

    public abstract Double cost();
}

class HouseBlend extends Beverage {
    public HouseBlend() {
        description = "HouseBlend";
    }

    @Override
    public Double cost() {
        return 1.0;
    }
}

class DarkRoast extends Beverage {
    public DarkRoast() {
        description = "DarkRoast";
    }

    @Override
    public Double cost() {
        return 2.0;
    }
}

class Espresso extends Beverage {
    public Espresso() {
        description = "Espresso";
    }

    @Override
    public Double cost() {
        return 3.0;
    }
}

class Decaf extends Beverage {
    public Decaf() {
        description = "Decaf";
    }

    @Override
    public Double cost() {
        return 4.0;
    }
}

abstract class  CondimentDecorator extends Beverage{
    @Override
    public abstract String getDescription();
}

class Milk extends CondimentDecorator{

    Beverage beverage;

    public Milk(Beverage beverage) {
        this.beverage = beverage;
    }

    @Override
    public Double cost() {
        return beverage.cost() + 0.1;
    }

    @Override
    public String getDescription() {
        return beverage.getDescription()+ "加入了Milk";
    }
}

class Mocha extends CondimentDecorator{

    Beverage beverage;

    public Mocha(Beverage beverage) {
        this.beverage = beverage;
    }

    @Override
    public Double cost() {
        return beverage.cost() + 0.2;
    }

    @Override
    public String getDescription() {
        return beverage.getDescription()+ "加入了Mocha";
    }
}

class Soy extends CondimentDecorator{

    Beverage beverage;

    public Soy(Beverage beverage) {
        this.beverage = beverage;
    }

    @Override
    public Double cost() {
        return beverage.cost() + 0.3;
    }

    @Override
    public String getDescription() {
        return beverage.getDescription()+ "加入了Soy";
    }
}


class Whip extends CondimentDecorator{

    Beverage beverage;

    public Whip(Beverage beverage) {
        this.beverage = beverage;
    }

    @Override
    public Double cost() {
        return beverage.cost() + 0.4;
    }

    @Override
    public String getDescription() {
        return beverage.getDescription()+ "加入了Whip";
    }
}
